package com.mach.platform.exception;

import com.mach.platform.domain.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Administrator
 * @Description: 自定义异常处理类
 * @Package: com.mach.platform.exception
 * @time 2018/4/24 0024 13:55
 */
@Slf4j
@RestControllerAdvice
public class CustomizedExceptionHandlers {

	/**
	 * springsecurity 拦截访问权限接管处理
	 *
	 * @return Response
	 */
	@ExceptionHandler(value = AccessDeniedException.class)
	public Response securityRoleAccessFailedException ( ) {
		Response response = Response.builder().msg("角色权限受限，不能访问该请求！").status(403).build();
		return response;
	}

}
